package com.dzu.easy;

/**
 * @author ZhaoDong
 * @date 2022/10/8 9:57
 * @description 389. 找不同
 */
public class Test389 {

    public static void main(String[] args) {
        System.out.println(findTheDifference("a", "aa"));
    }



    // 使用异或运算
    public static char findTheDifference(String s, String t) {
        char ans = t.charAt(t.length() - 1);
        for (int i = 0; i < s.length(); i++) {
            ans ^= s.charAt(i);
            ans ^= t.charAt(i);
        }
        return ans;
    }
}
